package ams.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ams.dao.IBaseDao;
import ams.model.dto.Login;
import ams.model.entity.User;

@Service("loginService")
public class LoginService implements ILoginService {
	
	@Autowired
	private IBaseDao<User> userDao;

	@Override
	public boolean isAllowed(Login login) {
		Long count = userDao.count("select count(*) from User u where u.account = ? and u.pwd = ? ", new Object[]{login.getAccount(),login.getPwd()});
		if(count == 1){
			return true;
		}
		return false;
	}

}
